import Vue from 'vue'
import Router from 'vue-router'
import Home from "../views/Home/Home"
import Subcribe from "../views/SubcribePage/SubcribePage"
import UserSubcribe from "../views/UserSubcribe/UserSubcribe"
import Jurisdiction from "../views/Jurisdiction/Jurisdiction"
import ToExamine from "../views/ToExamine/ToExamine"
import Detail from "../views/Detail/Detail"
import CreateStaff from "../views/CreateStaff/CreateStaff"
import StaffMsg from "../views/Operational/staff.vue"
import UserMsg from "../views/Operational/user.vue"
Vue.use(Router)    //Vue使用Router
export default new Router({ 
  mode: 'history', 
  routes: [
    {
      path:'/home/:role',
      name:'Home',
      component:Home,
      meta: {
        title: "访客预约云平台"
      }
    },
    {
      path:'/subcribe',
      name:'Subcribe',
      component:Subcribe,
      meta: {
        title: "预约页面"
      }
    },
    {
      path:'/userSubcribe',
      name:'UserSubcribe',
      component:UserSubcribe,
      meta: {
        title: "预约页面"
      }
    },
    {
      path:'/juris',
      name:'Jurisdiction',
      component:Jurisdiction,
      meta: {
        title: "预约页面"
      }
    },
    {
      path:'/toexa',
      name:'ToExamine',
      component:ToExamine,
      meta: {
        title: "我的审核"
      }
    },
    {
      path:'/detail',
      name:'Detail',
      beforeEnter: (to, from, next) => {
        if (from.path == '/toexa') {
          to.meta.title = '预约详情'
        } else {
          to.meta.title = '我的预约凭证'
        }
        next()
      },
      component:Detail,
    },
    {
      path:'/createStaff',
      name:'CreateStaff',
      component:CreateStaff,
      meta: {
        title: "员工登记"
      }
    },
    {
      path:'/staffMsg',
      name:'StaffMsg',
      component:StaffMsg,
      meta: {
        title: "员工操作指引"
      }
    },
    {
      path:'/userMsg',
      name:'UserMsg',
      component:UserMsg,
      meta: {
        title: "用户操作指引"
      }
    }
  ]
})